home *** CD-ROM | disk | FTP | other *** search
/ Power Hacker 2003 / Power_Hacker_2003.iso / Exploit and vulnerability / w00w00 / sectools / SRS / server / include / functions.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-12  |  5.1 KB  |  156 lines

  1. #ifndef _FUNCTIONS_H
  2. #define _FUNCTIONS_H
  3.  
  4. __BEGIN_DECLS
  5.  
  6. /* fix implicit declarions */
  7. char *inet_ntoa __P((struct in_addr in));
  8. int gethostname  __P((char *name, size_t len));
  9. /* ----------------------- */
  10.  
  11. /* setup/init code */
  12. void init();           /* basic inits..            */
  13. void shrMemInit();     /* initialize shared memory */
  14.  
  15. void setup();          /* do the general setup     */
  16.  
  17. void setupFiles();     /* setup the SRS files      */
  18. void setupClients();   /* setup client structures  */
  19. void setupSubIDs();    /* setup the Sub-ID's       */
  20.  
  21. void setPids(int pid); /* setup the pid's          */
  22. /* ------------ */
  23.  
  24. /* ------ socket code ------ */
  25. void initconn();    /* binds to the port, listens for a connection, etc. */
  26. int getconn();      /* this accepts the connection and sets stuff up...  */
  27.  
  28. void setsockopts(); /* setup socket options */
  29. /* ------------------------- */
  30.  
  31. /* ---- server I/O functions ---- */
  32. /* read/write data from/to client */
  33. void send_data __P((int fd, char *fmt, ...)); 
  34. void recv_data __P((int fd, char *readbuf, int len, int notify));
  35. /* ------------------------------- */
  36.  
  37. /* ------ auth functions ------ */
  38. void authClient __P((char *str, const int len));
  39. /* ---------------------------- */
  40.  
  41. /* configuration functions */
  42. void readSysConf();           /* read syslog.conf from client */
  43. void printConfig();           /* output config logs (stats)   */
  44. /* ----------------------- */
  45.  
  46. /* ---- parsing functions ---- */
  47. void getID    __P((char *str));       /* parse client ID   */
  48.  
  49. void parseSysConf __P((char *str));   /* parse syslog.conf */
  50.  
  51. void parseRemHost __P((char *str));   /* parse remote host */
  52. void parseNamedPipe __P((char *str)); /* parse named pipe  */
  53.  
  54. int parseFac __P((char *str, int numfacs)); /* parse multi-facilities */
  55. void parsePri __P((char *str));             /* parse priority for fac */
  56.  
  57. void parseFile __P((char *str, int didfacs, int numfacs, \
  58.                     char *fac, char *pri)); /* parse file name */
  59.  
  60. void doLogging __P((char *str)); /* parse/log client's syslog msg */
  61. /* --------------------------- */
  62.  
  63. /* conversion functions */
  64. int priNameToVal __P((char *priority));
  65. char *priValToName __P((int priority));
  66.  
  67. int facNameToVal __P((char *facility));
  68. char *facValToName __P((int facility));
  69. /* -------------------- */
  70.  
  71. /* handle client data */
  72. void procData(int stopit); /* process data from client */
  73.  
  74. /* send stuff to the client */
  75. void sendSubID();        /* send client its sub-ID */
  76. void sendVers();         /* send client the current client/server ver. */
  77. void sendServList();     /* send client the current stream server list */ 
  78. /* ------------------ */
  79.  
  80. /* ping stuff */
  81. void startPings();       /* fork child and start pinging          */
  82. void sendPings();        /* send pings & get pongs to/from client */
  83. /* ---------- */
  84.  
  85. /* SSL functions */
  86. #ifndef NOSSL
  87. void loadDHparams();            /* load dh parameter file */
  88. void makeSSLconn __P((int fd)); /* init. SSL connections  */
  89. #endif
  90. /* ------------- */
  91.  
  92. /* misc. functions */
  93. void usage  __P((char *progname));        /* give proper usage    */
  94. void doArgs __P((int argc, char **argv)); /* parse and setup args */
  95.  
  96. void createDirs __P((int client));    /* creates clients' logging dirs */
  97.  
  98. void checkValid();          /* make sure structs and pids are right */
  99. void checkValid1();         /* make sure structs and pids are right */
  100.  
  101. int  checkMaxSubIDs();      /* make sure we're not over the limit   */
  102.  
  103. void getOkay();             /* check for OKAY from client (verify)  */
  104.  
  105. void daemonize();           /* daemonize into background */
  106.  
  107. void makeHostArgs __P((int argc, char **argv)); /* put hostname in args */
  108.  
  109. char *exportInt __P((int value));   /* export int for cmd len */
  110. int  importInt  __P((char *value)); /* import int for cmd len */
  111.  
  112. void copyLogStruct __P((int srcstruct, int dststruct)); /* copy log structs */
  113.  
  114. void getSRSuser(); /* get uid of SRS user in passwd file */
  115. /* --------------- */
  116.  
  117. /* streaming stuff */
  118. void initStream();     /* initialize files for streaming */
  119. void readStream();     /* read streams from the client   */
  120. /* --------------- */
  121.  
  122. /* sighandlers (should all be self-explanatory) */
  123. RETSIGTYPE sighandler __P((int signum));
  124.  
  125. RETSIGTYPE IDtimeout     __P((int signum));
  126. RETSIGTYPE authIDtimeout __P((int signum));
  127.  
  128. RETSIGTYPE InsTimeout  __P((int signum));
  129. RETSIGTYPE okayTimeout __P((int signum));
  130. RETSIGTYPE pingTimeout __P((int signum));
  131.  
  132. RETSIGTYPE startUp    __P((int signum));
  133. RETSIGTYPE gotNewData __P((int signum));
  134. /* -------------------------------------------- */
  135.  
  136. /* functions for debugging/errors */
  137. void debug __P((char *fmt, ...));  /* func to report debugging info   */
  138. void error __P((char *fmt, ...));  /* func to write errors to err log */
  139. /* -------------------- */
  140.  
  141. /* functions for exiting */
  142. void quit __P((int stat));  /* used when exiting.. to free structures */
  143.  
  144. void closeSockets();        /* close the client sockets   */
  145. void closeLogFiles();       /* close and free log files   */
  146.  
  147. void freeClients();         /* free the client structures */
  148. void freeSharedMem();       /* free/detach shared memory  */
  149.  
  150. void doKills();             /* kill() the child processes */
  151. /* --------------------- */
  152.  
  153. __END_DECLS
  154.  
  155. #endif /* _FUNCTIONS_H */
  156.